<?php
require_once('../lib/utils/pdf_oficio_vinculacion.php');
require_once('../Connections/miportal.php'); 

if(isset($_GET['id'])){
		$curp=$_GET['id'];
}else{
	$curp="error";
}
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}





mysql_select_db($database_miportal, $miportal);
$query_rs_candidato = sprintf("SELECT id_cor_candidato,id_cve_curp,id_cve_curp,id_nmbNombre, 
 nb_nom_nombre1, nb_nom_nombre2, nb_nom_apaterno, nb_nom_amaterno,id_nom_fiscal,  
 tp_status_validacion FROM asignaciones WHERE id_cat_convocatoria=17 AND tp_status_validacion=1 AND id_cat_ies=%s", $_GET['oficio'] );
$rs_candidato = mysql_query($query_rs_candidato, $miportal) or die(mysql_error());
$row_rs_candidato = mysql_fetch_assoc($rs_candidato);
$totalRows_rs_candidato = mysql_num_rows($rs_candidato);


//FIN OBENCIÓN DE DATOS
$fpdf= new PDF();
$fpdf->AddPage('L','Letter');
$fpdf->SetFont('Arial','',8);
$fpdf->Ln(30);

$counter=1;
$header = array('NO.','FOLIO','CURP', 'NOMBRE','EMPRESA');


/**

echo '<table cellpadding="0" cellspacing="0" width="100%">';
    echo '<thead><tr><td>No.</td><td>CLAVE</td><td>CURP</td><td>NOMBRE</td> <td>PRIMARIA</td></tr></thead>';
for($i=0;$i<$totalRows_rs_candidato; $i++){
	
	$fila = mysql_fetch_array($rs_candidato);
	$numlista = $i + 1;
        echo '<tr><td>'.$numlista.'</td>';
        echo '<td>'.$fila['id_cor_candidato'].'</td>';
        echo '<td>'.$fila['id_cve_curp'].'</td>';
		
        
    }
    echo "</table>";
**/


$data =$row_rs_candidato;/* array( ''.$counter , 'EMP00'.$row_rs_candidato['id_cor_candidato'] .'13','' .$row_rs_candidato['id_cve_curp'], '' .$row_rs_candidato['nb_nom_nombre1']. ' ' .$row_rs_candidato['nb_nom_nombre2'].' ' .$row_rs_candidato['nb_nom_apaterno'].' '.$row_rs_candidato['nb_nom_amaterno'],' ' .$row_rs_candidato['nb_primaria']);*/


//return $data;
//$data = $fpdf->LoadData('../docs/paises.txt'); 
$fpdf->table_heder($header); 

   for($i=0;$i<$totalRows_rs_candidato; $i++){
	   $fpdf->table_body($i+1,$data);
	   $data = mysql_fetch_assoc($rs_candidato);
   }
   
   
   
   
   $fpdf->hr();
$fpdf->Output();






?>





